<!doctype html>
<html lang="en">
<!-- <?php
    if(!file_exists("count.txt")){
        $one_file=fopen("count.txt","w+"); //建立一个统计文本，如果不存在就创建
        echo"您是第<font color='red'><b>1</b></font>位访客"; //首次直接输出第一次
        fwrite("count.txt","1");  //把数字1写入文本
        fclose("$one_file");
     }else{ //如果不是第一次访问直接读取内容，并+1,写入更新后再显示新的访客数
        $num=file_get_contents("count.txt");
        $num++;
        file_put_contents("count.txt","$num");
        $newnum=file_get_contents("count.txt");
        echo"您是第<font color='red'><b>".$newnum."</b></font>位访客";
    }
?> -->

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
	<meta name="description" content="">
	<meta name="author" content="">
	<title>论文降重助手</title> <!-- Favicon-->
	<link rel="icon" type="image/x-icon" href="assets/iconk.ico"> <!-- Bootstrap icons -->

	<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css" rel="stylesheet"
		type="text/css"> <!-- Core theme CSS (includes Bootstrap)-->
	<link href="css/styles.css" rel="stylesheet">
	<link rel="stylesheet" href="css/index.css">
	<!-- <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"> -->
	</script>
	<!-- <script>
		var _hmt = _hmt || [];
		(function () {
			var hm = document.createElement("script");
			hm.src = "https://hm.baidu.com/hm.js?969726398af7e833bb6e27106709692b";
			var s = document.getElementsByTagName("script")[0];
			s.parentNode.insertBefore(hm, s);
		})();
	</script> -->
	<!-- 弹窗代码)-->
	<script type="text/javascript" src="./x_admin_show/jquery.min.js"></script>
	<script src="./x_admin_show/layui.js" charset="utf-8"></script>
	<script type="text/javascript" src="./x_admin_show/xadmin.js"></script>

	<!--富强-->
	<!-- <script type="text/javascript">
		/* 鼠标特效 */
		var a_idx = 0;
		jQuery(document).ready(function ($) {
			$("body").click(function (e) {
				var a = new Array("富强", "民主", "文明", "和谐", "自由", "平等", "公正", "法治", "爱国", "敬业", "诚信", "友善");
				var $i = $("<span/>").text(a[a_idx]);
				a_idx = (a_idx + 1) % a.length;
				var x = e.pageX,
					y = e.pageY;
				$i.css({
					"z-index": 999,
					"top": y - 20,
					"left": x,
					"position": "absolute",
					"font-weight": "bold",
					"color": "#ff6651"
				});
				$("body").append($i);
				$i.animate({
					"top": y - 180,
					"opacity": 0
				},
					1500,
					function () {
						$i.remove();
					});
			});
		}); 
	</script> -->
	<!--edn--富强-->

</head>

<body>
	<nav class="navbar navbar-light bg-light static-top">
		<div class="container">
			<a class="navbar-brand " href="#">本网站提供的降重功能完全免费！</a>
			<a class="btn btn-primary" href="chatgpt/index.html" id="firstUse">Ai助手(ChatGPT)</a>
		</div>
	</nav>
	<header class="masthead">
		<div class="container position-relative">
			<div class="row justify-content-center">
				<div class="col-xl-6">
					<div class="text-center text-white">
						<div class="meBox">
							<!-- 头像 -->
							<div class="headPhoto" class="alert-link"></div>
						</div>


						<h1 class="mb-5" id="start">
							<k href="#">论文降重助手</k>
						</h1>
						<div class="row">
							<div class="col ">
								<input class="input-lg form-control	 form-control-lg originData" type="text"
									placeholder="请在这里输入要降重的文本（中文）" value="">
							</div>
						</div>
						<div class="col-auto">
							<button style="margin: 15px;" class="btn btn-dark btn-md translateAndCompareBtn"
								type="button">降重并对比</button>
							<button style="margin: 15px;" class="btn btn-danger btn-md clear" type="button">清空</button>
							<button style="margin: 15px;" class="btn btn-primary btn-md translateBtn"
								type="button">降重</button>
							<button style="margin: 15px;" class="btn btn-primary btn-md compare"
								type="button">对比</button>
							<a style="margin:27px" class="btn btn-warning btn-md helpTip" id="helpTip"
								title="如果遇到不懂可以查阅使用说明" a
								onclick="x_admin_show('降重助手说明文档','https://docs.qq.com/doc/DV1ZKTXRnYndGWVlL','640','780')"
								class="alert-link">帮助</a>
							<a style="margin:27px" class="btn btn-warning btn-md helpTip" id="helpTip"
								title="您的打赏是我们完善该功能的动力！"
								onclick="x_admin_show(' 😘请我喝杯咖啡☕','assets/img/money.jpg','440','680')">欢迎打赏</a>
							<br>
						</div>
					</div>
				</div>
			</div>
		</div>
	</header>
	<section class="showcase ">
		<div class="container-fluid p-0 ">
			<div class="row g-0 ">
				<div class="col-lg-6 order-lg-1 my-auto showcase-text">
					<h2>降重结果1
						<a class="btn btn-default btn-sm clipboard clipboard" href="javascript:"
							data-clipboard-target="#newData" title="点击复制当前降重结果"><button
								class="button button1">复制</button></a>
						<span class="btn btn-default btn-sm restart" title="出现问题了？点击重试吧！"
							style="display: none;">重试</span>
					</h2>
					<p class="lead mb-0 form-control newData " id="newData"></p>
					<h4 style="margin-top: 9px;"> 对比结果1
						<a class="btn btn-default btn-sm clipboard clipboard" href="javascript:"
							data-clipboard-target="#compareData">复制</a>
					</h4>
					<p class="compareRes mb-0 form-control compareData " id="compareData"></p>
				</div>
			</div>
			<div class="row g-0">
				<div class="col-lg-6 my-auto showcase-text">
					<h2>降重结果2
						<a class="btn btn-default btn-sm clipboard clipboard" href="javascript:"
							data-clipboard-target="#newData1" title="点击复制当前降重结果"><button
								class="button button2">复制</button></a>
						<span class="btn btn-default btn-sm restart1" title="出现问题了？点击重试吧！"
							style="display: none;">重试</span>
					</h2>
					<p class="lead mb-0 form-control newData1" id="newData1"></p>
					<h4 style="margin-top: 9px;"> 对比结果2
						<a class="btn btn-default btn-sm clipboard clipboard" href="javascript:"
							data-clipboard-target="#compareData1">复制</a>
					</h4>
					<p class="compareRes mb-0 form-control compareData1 " id="compareData1"></p>
				</div>
			</div>
			<div class="row g-0">
				<div class="col-lg-6 order-lg-1 my-auto showcase-text">
					<h2>降重结果3
						<a class="btn btn-default btn-sm clipboard clipboard" href="javascript:"
							data-clipboard-target="#newData2" title="点击复制当前降重结果"><button
								class="button button3">复制</button></a>
						<span class="btn btn-default btn-sm restart2" title="出现问题了？点击重试吧！"
							style="display: none;">重试</span>
					</h2>
					<p class="lead mb-0 form-control newData2" id="newData2"></p>
					<h4 style="margin-top: 9px;"> 对比结果3
						<a class="btn btn-default btn-sm clipboard clipboard" href="javascript:"
							data-clipboard-target="#compareData2">复制</a>
					</h4>
					<p class="compareRes mb-0 form-control compareData2 " id="compareData2"></p>
				</div>
			</div>
			<div class="row g-0">
				<div class="col-lg-6 order-lg-1 my-auto showcase-text">
					<h2>降重结果4
						<a class="btn btn-default btn-sm clipboard clipboard" href="javascript:"
							data-clipboard-target="#newData3" title="点击复制当前降重结果"><button
								class="button button4">复制</button></a>
						<span class="btn btn-default btn-sm restart3" title="出现问题了？点击重试吧！"
							style="display: none;">重试</span>
					</h2>
					<p class="lead mb-0 form-control newData3" id="newData3"></p>
					<h4 style="margin-top: 9px;"> 对比结果4
						<a class="btn btn-default btn-sm clipboard clipboard" href="javascript:"
							data-clipboard-target="#compareData3">复制</a>
					</h4>
					<p class="compareRes mb-0 form-control compareData3 " id="compareData3"></p>
				</div>
			</div>
			<div class="row g-0">
				<div class="col-lg-6 order-lg-1 my-auto showcase-text">
					<h2>降重结果5
						<a class="btn btn-default btn-sm clipboard clipboard" href="javascript:"
							data-clipboard-target="#newData4" title="点击复制当前降重结果"><button
								class="button button5">复制</button></a>
						<span class="btn btn-default btn-sm restart4" title="出现问题了？点击重试吧！"
							style="display: none;">重试</span>
					</h2>
					<p class="lead mb-0 form-control newData4" id="newData4"></p>
					<h4 style="margin-top: 9px;"> 对比结果5
						<a class="btn btn-default btn-sm clipboard clipboard" href="javascript:"
							data-clipboard-target="#compareData4">复制</a>
					</h4>
					<p class="compareRes mb-0 form-control compareData4 " id="compareData4"></p>
				</div>
			</div>
			<div class="row g-0">
				<div class="col-lg-6 order-lg-1 my-auto showcase-text">
					<h2>降重结果6
						<a class="btn btn-default btn-sm clipboard clipboard" href="javascript:"
							data-clipboard-target="#newData5" title="点击复制当前降重结果"><button
								class="button button1">复制</button></a>
						<span class="btn btn-default btn-sm restart5" title="出现问题了？点击重试吧！"
							style="display: none;">重试</span>
					</h2>
					<p class="lead mb-0 form-control newData5" id="newData5"></p>
					<h4 style="margin-top: 9px;"> 对比结果6
						<a class="btn btn-default btn-sm clipboard clipboard" href="javascript:"
							data-clipboard-target="#compareData5">复制</a>
					</h4>
					<p class="compareRes mb-0 form-control compareData5 " id="compareData5"></p>
				</div>
			</div>
	</section> <!-- Call to Action-->
	<!-- <section class="call-to-action text-white text-center" id="signup">
		<div class="container position-relative">
			<div class="row justify-content-center">
				<div class="col-xl-6">
					<h2 class="mb-4" id="account">请在这配置账号</h2>
					<form class="form-subscribe" id="contactFormFooter">
						<div class="row">
							<div class="col">
								<input class="form-control form-control-lg" id="yourAppid" type="text"
									placeholder="appid" title="在这输入你的百度翻译API的appid">
							</div>
							<div class="col">
								<input class="form-control form-control-lg" id="yourKey" type="text" placeholder="key"
									title="在这输入你的百度翻译API的key">
							</div>
						</div>
						<div class="col-auto"> <button style="margin:27px" class="btn btn-primary btn-md " id="saveBtn"
								type="button" title="点击保存你的账号">保存</button> <button style="margin:27px"
								class="btn btn-danger btn-md " id="deleteBtn" type="button"
								title="确定要删除你的账号吗？">删除</button> <a style="margin:27px"
								class="btn btn-warning btn-md helpTip" id="helpTip" title="如果遇到不懂可以查阅使用说明"
								href="https://docs.qq.com/doc/DSkJDanRuVE9ZYmFE">注册账号</a>
							<a style="margin:27px" class="btn btn-warning btn-md helpTip" id="helpTip"
								title="仅供测试，请勿用作论文降重，防止信息泄露！" href="./test.html">测试账号</a> <br>
							<a>新注册账号如显示配置错误，请去百度翻译开放平台重置密钥，并重启服务。如有问题请微信联系Action</a><br />
						</div>
					</form>
				</div>
			</div>
		</div>
	</section> -->
	<!-- Footer-->
	<footer class="footer bg-light">
		<div class="container">
			<div class="row">
				<div class="col-lg-6 h-100 text-center text-lg-start my-auto">
					<ul class="list-inline mb-2">
						<li class="list-inline-item">
							<a href="#">导航主页</a>
						</li>
						<li class="list-inline-item">
							<a href="https://github.com/youjingkai">作者Github</a>
						</li>
						<li class="list-inline-item">
							<a href="https://gitee.com/a-slice">Gitee主页</a>
						</li>
						<li class="list-inline-item">
							<a href="https://docs.qq.com/doc/DV1ZKTXRnYndGWVlL">使用帮助</a>
						</li><br />
						<a onclick="x_admin_show('长按扫码，微信：ActionWeb','assets/img/weixin.jpg','430','587')"
							class="alert-link" type="button">
							<font color="green">联系作者 </font>
						</a>
						<a onclick="x_admin_show('电脑版点击右方的最大化按钮进行留言反馈 👉','https://support.qq.com/embed/phone/307849?','440','680')"
							class="alert-link" type="button">
							<font color="orange">用户反馈 </font>
						</a>
						<a onclick="x_admin_show(' 😘请我喝杯咖啡☕','assets/img/money.jpg','440','680')" class="alert-link"
							type="button">
							<font color="red"> 😘请我喝杯咖啡吧☕ </font>
						</a>

					</ul>
					<p class="text-muted small mb-4 mb-lg-0">本网站由@ hanghang 进行更新维护<br />
						如有问题请在微信联系：ActionWeb<br /> & hanghang 2023. All Rights Reserved. </p>
				</div>
				<div class="col-lg-6 h-100 text-center text-lg-end my-auto">
					<span id="busuanzi_container_page_pv">
						<!--你是我的第<span id="busuanzi_value_site_uv"></span>个小伙伴<br />
							本站总访问量<span id="busuanzi_value_site_pv"></span>次<br />-->
						<script
							type="text/javascript">document.write(unescape("%3Cspan id='cnzz_stat_icon_1280944116'%3E%3C/span%3E%3Cscript src='https://v1.cnzz.com/z_stat.php%3Fid%3D1280944116%26online%3D1%26show%3Dline' type='text/javascript'%3E%3C/script%3E"));</script>
						<br />
						提供毕设、课设代做业务，各种网页以及管理系统代做。如有需要请联系微信：ActionWeb
					</span>
					<!-- <ul class="list-inline mb-0">

						<li class="list-inline-item me-4">
							<a href="https://freysu.github.io/" onclick="showToast('即将跳转到作者的博客...',1500)"><i
									class="bi-github fs-3"></i></a>
						</li>
						<li class="list-inline-item me-4">
							<a href="https://www.coolapk.com/u/3128087">
								<img class="contact" src="./assets/img/coolapk.png" alt="" title="联系我"
									style="width: 1.66875rem;margin-top:-0.625rem ;">
							</a>
						</li>
						<li class="list-inline-item me-4">
							<a href="https://github.com/freysu" onclick="showToast('即将跳转到作者的Github主页...',1500)"><i
									class="bi-github fs-3"></i></a>
						</li>

					</ul> -->
				</div>
			</div>
		</div>
	</footer>

	<div class="fixed_btn">
		<a>
			<img class="btu" src="./assets/img/返回顶部.png" alt="" title="返回顶部"
				onclick="window.scrollTo(0, 0);showToast('返回顶部',1000);">
		</a>



		<a onclick="x_admin_show('长按扫码，微信：ActionWeb','assets/img/weixin.jpg','430','587')" class="alert-link">

			<img class="contact img-rounded" src="./assets/img/联系人.png" alt="" title="联系我">
		</a>
		<a href="#start">
			<img class="bti img-rounded" src="./assets/img/返回输入框.png" alt="" title="返回到翻译内容输入框"
				onclick="showToast('返回到翻译内容输入框',1000)">
		</a>
		<a href="#account">
			<img class="btd" src="./assets/img/返回底部.png" alt="" title="跳转到账号配置区域" onclick="showToast('跳转到账号配置区域',1000)">
		</a>
	</div>
	<script src="https://cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
	<script src="https://cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <!-- Bootstrap core JS-->
	<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
	<!-- Core theme JS-->
	<script src="https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js"></script>
	<script src="./js/md5.js"></script>
	<script type="text/javascript">
		var clipboard = new ClipboardJS('.clipboard');
	</script>
	<script>
		(function () {
			localStorage.setItem("appid1", "20230508001670192");
			localStorage.setItem("key1", "BpFqTSzyz6AhxTJdIdWC");
		})();
		let to = $(".originData");
		let from = $(".newData");
		let from1 = $(".newData1");
		let from2 = $(".newData2");
		let from3 = $(".newData3");
		let from4 = $(".newData4");
		let from5 = $(".newData5");
		let compare = $(".compareData");
		let compare1 = $(".compareData1");
		let compare2 = $(".compareData2");
		let compare3 = $(".compareData3");
		let compare4 = $(".compareData4");
		let compare5 = $(".compareData5");

		let appid = localStorage.getItem("appid1");
		let key = localStorage.getItem("key1");
		const url = 'https://api.fanyi.baidu.com/api/trans/vip/translate';
		let timer = null;

		$("#yourAppid").val(appid);
		$("#yourKey").val(key);

		if (!localStorage.getItem("appid1") || !localStorage.getItem("key1" || localStorage.appid1 == null || localStorage
			.key1 == null)) {
			setTimeout(() => {
				showToast("初始化完毕~请刷新页面！", 3500)
				// location.href = "#account";
			}, 2000)
		} else {
			showToast('欢迎使用~', 1500)
		}

		// $("#saveBtn").click(() => {
		// 	const fn = () => {
		// 		let _appid = $("#yourAppid").val();
		// 		let _key = $("#yourKey").val()
		// 		if (!_appid || !_key) {
		// 			showToast("请重新输入！", 1500)
		// 		} else {
		// 			localStorage.setItem("appid1", _appid);
		// 			localStorage.setItem("key1", _key);
		// 			showToast("保存成功！", 2000)
		// 			location.href = "./index.html";
		// 		}
		// 	}
		// 	if (timer !== null) {
		// 		clearTimeout(timer);
		// 	}
		// 	timer = setTimeout(() => {
		// 		fn();
		// 		timer = null;
		// 	}, 500);
		// })
		(function () {
			localStorage.setItem("appid1", "20230508001670192");
			localStorage.setItem("key1", "BpFqTSzyz6AhxTJdIdWC");
		})();
		$("#deleteBtn").click(() => {
			const fn = () => {
				localStorage.removeItem("appid1");
				localStorage.removeItem("key1");
				showToast("已删除...下次使用请重新保存！", 2000)
				$("#yourAppid").val("");
				$("#yourKey").val("");
			}
			if (timer !== null) {
				clearTimeout(timer);
			}
			timer = setTimeout(() => {
				fn();
				timer = null;
			}, 500);
		})

		$(".clear").click(() => {
			const fn = () => {
				$(".originData").val("");
				$(".lead").text("此处将会显示降重结果")
				$(".compareRes").text("此处将会显示对比结果")
			}
			if (timer !== null) {
				clearTimeout(timer);
			}
			timer = setTimeout(() => {
				fn();
				timer = null;
			}, 500);
		})

		$(".translateBtn").click(() => {
			const fn = () => {
				if (!localStorage.getItem("appid1") || !localStorage.getItem("key1")) {
					showToast("您未配置账号，请配置完账号再开始使用...", 3000);
				} else if (to.val() == "") {
					showToast("你未输入要翻译的内容...", 1500);
				} else {
					location.href = "#res1";
					translateMain(0);
				}
			}
			if (timer !== null) {
				clearTimeout(timer);
			}
			timer = setTimeout(() => {
				fn();
				timer = null;
			}, 500);
		})

		$(".translateAndCompareBtn").click(() => {
			const fn = () => {
				if (!localStorage.getItem("appid1") || !localStorage.getItem("key1")) {
					showToast("您未配置账号，请配置完账号再开始使用.点击左上角或者滑动到页面最下方进行配置...", 5000);
				} else if (to.val() == "") {
					showToast("你未输入内容所以无法进行降重和对比...", 3500);
				} else {
					location.href = "#res1";
					showToast("正在降重中...请耐心等待", 3500);
					translateMain(1);
				}
			}
			if (timer !== null) {
				clearTimeout(timer);
			}
			timer = setTimeout(() => {
				fn();
				timer = null;
			}, 500);
		})

		$(".compare").click(() => {
			const fn = () => {
				if (to.val() == "") {
					showToast("你未输入要翻译的内容所以无法对比...", 1500);
				} else {
					location.href = "#res1";
					showToast("正在对比...", 1500);
					compareMain();
				}
			}
			if (timer !== null) {
				clearTimeout(timer);
			}
			timer = setTimeout(() => {
				fn();
				timer = null;
			}, 500);
		})

		$(".restart").on("click", function () {
			showToast("正在重试...", 1500);
			from.html("正在重试...");
			translateZeroFn(1);
		});

		$(".restart1").on("click", function () {
			showToast("正在重试...", 1500);
			from1.html("正在重试...");
			translateOneFn(1);
		});

		$(".restart2").on("click", function () {
			showToast("正在重试...", 1500);
			from2.html("正在重试...");
			translateTwoFn(1);
		});

		$(".restart3").on("click", function () {
			showToast("正在重试...", 1500);
			from3.html("正在重试...");
			translateThreeFn(1);
		});

		$(".restart4").on("click", function () {
			showToast("正在重试...", 1500);
			from4.html("正在重试...");
			translateFourFn(1);
		});

		$(".restart5").on("click", function () {
			showToast("正在重试...", 1500);
			from5.html("正在重试...");
			translateFiveFn(1);
		});

		function translateZeroFn(fn = 0) {
			// zh-en-zh
			translateFn(to.val(), 'zh', 'en', (rs) => {
				if (rs !== "54003" && rs !== "") {
					translateFn(String(rs).replace(/^[“]+/, "").replace(/[”]$/, ""), "en", "zh", (rs) => {
						if (rs !== "54003" && rs !== "") {
							from.html(rs);
							from.css("color", "black");
							if (fn) {
								setTimeout(() => {
									compareMain("from")
								}, 1000);
							}
						} else {
							from.html('修改失败，请稍后重试......');
							from.css("color", "red");
							$(".restart").css("display", "inline-block")
							console.log("error-1:", rs);
						}
					});
				} else {
					from.html('修改失败，请稍后重试......');
					from.css("color", "red");
					$(".restart").css("display", "inline-block")
					console.log("error:", rs);
				}
			});
		}

		function translateOneFn(fn = 0) {
			// zh-jp-zh
			translateFn(to.val(), "zh", "jp", (rs) => {
				if (rs !== "54003" && rs !== "") {
					translateFn(String(rs).replace(/^[“]+/, "").replace(/[”]$/, ""), "jp", "zh", (rs) => {
						if (rs !== "54003" && rs !== "") {
							from1.html(rs);
							from1.css("color", "black");
							if (fn) {
								setTimeout(() => {
									compareMain("from1")
								}, 1000);
							}
						} else {
							from1.html("修改失败，请稍后重试......");
							from1.css("color", "red");
							$(".restart1").css("display", "inline-block")
							console.log("error1-1:", rs);
						}
					});
				} else {
					from1.html("修改失败，请稍后重试......");
					from1.css("color", "red");
					$(".restart1").css("display", "inline-block")
					console.log("error1:", rs);
				}
			})
		}

		function translateTwoFn(fn = 0) {
			// zh-fra-zh
			translateFn(to.val(), "zh", "fra", (rs) => {
				if (rs !== "54003" && rs !== "") {
					translateFn(String(rs).replace(/^[“]+/, "").replace(/[”]$/, ""), "fra", "zh", (rs) => {
						if (rs !== "54003" && rs !== "") {
							from2.html(rs);
							from2.css("color", "black");
							if (fn) {
								setTimeout(() => {
									compareMain("from2")
								}, 1000);
							}
						} else {
							from2.html("修改失败，请稍后重试......");
							from2.css("color", "red");
							$(".restart2").css("display", "inline-block")
							console.log("error2-1:", rs);
						}
					})
				} else {
					from2.html("修改失败，请稍后重试......");
					from2.css("color", "red");
					$(".restart2").css("display", "inline-block")
					console.log("error2:", rs);
				}
			});
		}

		function translateThreeFn(fn = 0) {
			// zh-ru-zh
			translateFn(to.val(), "zh", "ru", (rs) => {
				if (rs !== "54003" && rs !== "") {
					translateFn(String(rs).replace(/^[“]+/, "").replace(/[”]$/, ""), "ru", "zh", (rs) => {
						if (rs !== "54003" && rs !== "") {
							from3.html(rs);
							from3.css("color", "black");
							if (fn) {
								setTimeout(() => {
									compareMain("from3")
								}, 1000);
							}
						} else {
							from3.html("修改失败，请稍后重试......");
							from3.css("color", "red");
							$(".restart3").css("display", "inline-block")
							console.log("error3-1:", rs);
						}
					})
				} else {
					from3.html("修改失败，请稍后重试......");
					from3.css("color", "red");
					$(".restart3").css("display", "inline-block")
					console.log("error3:", rs);
				}
			});
		}

		function translateFourFn(fn = 0) {
			// zh-spa-zh
			translateFn(to.val(), "zh", "spa", (rs) => {
				if (rs !== "54003" && rs !== "") {
					translateFn(String(rs).replace(/^[“]+/, "").replace(/[”]$/, ""), "spa", "zh", (rs) => {
						if (rs !== "54003" && rs !== "") {
							from4.html(rs);
							from4.css("color", "black");
							if (fn) {
								setTimeout(() => {
									compareMain("from4")
								}, 1000);
							}
						} else {
							from4.html("修改失败，请稍后重试......");
							from4.css("color", "red");
							$(".restart4").css("display", "inline-block")
							console.log("error4-1:", rs);
						}
						// console.log("zh-spa-zh:", rs);
					})
				} else {
					from4.html("修改失败，请稍后重试......");
					from4.css("color", "red");
					$(".restart4").css("display", "inline-block")
					console.log("error4:", rs);
				}
			});
		}

		function translateFiveFn(fn = 0) {
			// zh-en-zh-ru-zh
			translateFn(to.val(), "zh", "en", (rs) => {
				if (rs !== "54003" && rs !== "") {
					translateFn(String(rs).replace(/^[“]+/, "").replace(/[”]$/, ""), "en", "zh", (rs) => {
						if (rs !== "54003" && rs !== "") {
							translateFn(String(rs).replace(/^[“]+/, "").replace(/[”]$/, ""), "zh", "ru", (
								rs) => {
								if (rs !== "54003" && rs !== "") {
									translateFn(String(rs).replace(/^[“]+/, "").replace(/[”]$/, ""),
										"ru",
										"zh",
										(rs) => {
											if (rs !== "54003" && rs !== "") {
												from5.html(rs);
												from5.css("color", "black");
												if (fn) {
													setTimeout(() => {
														compareMain("from5")
													}, 1000);
												}
											} else {
												from5.html("修改失败，请稍后重试......");
												from5.css("color", "red");
												$(".restart5").css("display", "inline-block")
												console.log("error5-3:", rs);
											}
										});
								} else {
									from5.html("修改失败，请稍后重试......");
									from5.css("color", "red");
									$(".restart5").css("display", "inline-block")
									console.log("error5-2:", rs);
								}
							});
						} else {
							from5.html("修改失败，请稍后重试......");
							from5.css("color", "red");
							$(".restart5").css("display", "inline-block")
							console.log("error5-1:", rs);
						}
					});
				} else {
					from5.html("修改失败，请稍后重试......");
					from5.css("color", "red");
					$(".restart5").css("display", "inline-block")
					console.log("error5:", rs);
				}
			});
		}

		function translateMain(fn = 0) {
			setTimeout(() => {
				translateFiveFn(fn);
			}, 1500, setTimeout(() => {
				translateFourFn(fn);
			}, 1500, setTimeout(() => {
				translateThreeFn(fn);
			}, 1500, setTimeout(() => {
				translateTwoFn(fn);
			}, 1500, setTimeout(() => {
				translateOneFn(fn);
			}, 1500, setTimeout(() => {
				translateZeroFn(fn);
			}, 1500))))));
		}


		function translateFn(QUERY, FROM, TO, callback) {
			const salt = (new Date()).getTime();
			const str1 = appid + QUERY + salt + key;
			const sign = MD5.main(str1);
			setTimeout(() => {
				$.ajax({
					url,
					type: 'get',
					// async: true,
					// 跨域
					dataType: 'jsonp',
					contentType: "application/x-www-form-urlencoded; charset=utf-8",
					data: {
						q: QUERY,
						appid: appid,
						salt: salt,
						from: FROM,
						to: TO,
						sign: sign,
					},
					success: (data) => {
						if (data.error_code == "52003") {
							showToast("账号配置出错，请重新配置...", 1500);
							return;
						} else if (data.error_code == "54003") {
							callback(data.error_code)
						} else {
							if (data.trans_result[0].dst) {
								callback(data.trans_result[0].dst)
							}
						}
					},
					error: function (data) {
						alert("error:" + data.status);
					},
				})
			}, 1500);
		}


		function showToast(msg, duration) {
			duration = isNaN(duration) ? 3000 : duration;
			var m = document.createElement('div');
			m.innerHTML = msg;
			m.style.cssText =
				"width:60%; min-width:180px; background:#000; opacity:0.6; height:auto;min-height: 30px; color:#fff; line-height:30px; text-align:center; border-radius:4px; position:fixed; top:60%; left:20%; z-index:999999;";
			document.body.appendChild(m);
			setTimeout(function () {
				var d = 0.5;
				m.style.webkitTransition = '-webkit-transform ' + d + 's ease-in, opacity ' + d +
					's ease-in';
				m.style.opacity = '0';
				setTimeout(function () {
					document.body.removeChild(m)
				}, d * 1000);
			}, duration);
		}

		function compareMain(op) {
			if (from.text() !== "修改失败，请稍后重试......" && from.text() !== "" && op === "from") {
				compareFn(compare, to, from)
			}
			if (from1.text() !== "修改失败，请稍后重试......" && from1.text() !== "" && op === "from1") {
				compareFn(compare1, to, from1)
			}
			if (from2.text() !== "修改失败，请稍后重试......" && from2.text() !== "" && op === "from2") {
				compareFn(compare2, to, from2)
			}
			if (from3.text() !== "修改失败，请稍后重试......" && from3.text() !== "" && op === "from3") {
				compareFn(compare3, to, from3)
			}
			if (from4.text() !== "修改失败，请稍后重试......" && from4.text() !== "" && op === "from4") {
				compareFn(compare4, to, from4)
			}
			if (from5.text() !== "修改失败，请稍后重试......" && from5.text() !== "" && op === "from5") {
				compareFn(compare5, to, from5)
			}
		}

		function compareFn(target, originData, newData) {
			target.html(eq({
				value1: newData.text(),
				value2: originData.val()
			}).value2)
		}

		function eq(op) {
			if (!op) {
				return op;
			}
			if (!op.eq_min) {
				op.eq_min = 3;
			}
			if (!op.eq_index) {
				op.eq_index = 5;
			}
			if (!op.value1 || !op.value2) {
				return op;
			}
			var ps = {
				v1_i: 0,
				v1_new_value: "",
				v2_i: 0,
				v2_new_value: ""
			};
			while (ps.v1_i < op.value1.length && ps.v2_i < op.value2.length) {
				if (op.value1[ps.v1_i] == op.value2[ps.v2_i]) {
					//ps.v1_new_value += op.value1[ps.v1_i].replace(/</g,"<").replace(">",">");
					ps.v2_new_value += op.value2[ps.v2_i]
						.replace(/</g, "<")
						.replace(">", ">");
					ps.v1_i += 1;
					ps.v2_i += 1;
					//值2增加的部分
					if (ps.v1_i >= op.value1.length) {
						ps.v2_new_value +=
							"<del style='color:red'>" +
							op.value2
								.substr(ps.v2_i)
								.replace(/</g, "<")
								.replace(">", ">") +
							"</del>";
						break;
					}
					//值1删除的部分
					if (ps.v2_i >= op.value2.length) {
						//ps.v1_new_value += "<span style='" + op.value1_style + "'>值1多的" + op.value1.substr(ps.v1_i).replace(/</g,"<").replace(">",">") + "</span>";
						ps.v2_new_value +=
							"<span style='color:green'>" +
							op.value1
								.substr(ps.v1_i)
								.replace(/</g, "<")
								.replace(">", ">") +
							"</span>";
						break;
					}
				} else {
					ps.v1_index = ps.v1_i + 1;
					ps.v1_eq_length = 0;
					ps.v1_eq_max = 0;
					ps.v1_start = ps.v1_i + 1;
					while (ps.v1_index < op.value1.length) {
						if (
							op.value1[ps.v1_index] == op.value2[ps.v2_i + ps.v1_eq_length]
						) {
							ps.v1_eq_length += 1;
						} else if (ps.v1_eq_length > 0) {
							if (ps.v1_eq_max < ps.v1_eq_length) {
								ps.v1_eq_max = ps.v1_eq_length;
								ps.v1_start = ps.v1_index - ps.v1_eq_length;
							}
							ps.v1_eq_length = 0;
							break; //只寻找最近的
						}
						ps.v1_index += 1;
					}
					if (ps.v1_eq_max < ps.v1_eq_length) {
						ps.v1_eq_max = ps.v1_eq_length;
						ps.v1_start = ps.v1_index - ps.v1_eq_length;
					}

					ps.v2_index = ps.v2_i + 1;
					ps.v2_eq_length = 0;
					ps.v2_eq_max = 0;
					ps.v2_start = ps.v2_i + 1;
					while (ps.v2_index < op.value2.length) {
						if (
							op.value2[ps.v2_index] == op.value1[ps.v1_i + ps.v2_eq_length]
						) {
							ps.v2_eq_length += 1;
						} else if (ps.v2_eq_length > 0) {
							if (ps.v2_eq_max < ps.v2_eq_length) {
								ps.v2_eq_max = ps.v2_eq_length;
								ps.v2_start = ps.v2_index - ps.v2_eq_length;
							}
							ps.v1_eq_length = 0;
							break; //只寻找最近的
						}
						ps.v2_index += 1;
					}
					if (ps.v2_eq_max < ps.v2_eq_length) {
						ps.v2_eq_max = ps.v2_eq_length;
						ps.v2_start = ps.v2_index - ps.v2_eq_length;
					}
					if (
						ps.v1_eq_max < op.eq_min &&
						ps.v1_start - ps.v1_i > op.eq_index
					) {
						ps.v1_eq_max = 0;
					}
					if (
						ps.v2_eq_max < op.eq_min &&
						ps.v2_start - ps.v2_i > op.eq_index
					) {
						ps.v2_eq_max = 0;
					}
					if (ps.v1_eq_max == 0 && ps.v2_eq_max == 0) {
						//两个值的字不同
						//ps.v1_new_value += "<span style='" + op.value1_style + "'>不同的" + op.value1[ps.v1_i].replace(/</g,"<").replace(">",">") + "</span>";
						ps.v2_new_value +=
							"<span style='color:green'>" +
							op.value1[ps.v1_i].replace(/</g, "<").replace(">", ">") +
							"</span>";
						ps.v2_new_value +=
							"<del style='color:red'>" +
							op.value2[ps.v2_i].replace(/</g, "<").replace(">", ">") +
							"</del>";
						ps.v1_i += 1;
						ps.v2_i += 1;

						if (ps.v1_i >= op.value1.length) {
							//值2增加的部分
							ps.v2_new_value +=
								"<del style='color:red'>" +
								op.value2
									.substr(ps.v2_i)
									.replace(/</g, "<")
									.replace(">", ">") +
								"</del>";
							break;
						}
						if (ps.v2_i >= op.value2.length) {
							//值1删除的部分
							//ps.v1_new_value += "<span style='" + op.value1_style + "'>值1多的" + op.value1.substr(ps.v1_i).replace(/</g,"<").replace(">",">") + "</span>";
							ps.v2_new_value +=
								"<span style='color:green'>" +
								op.value1
									.substr(ps.v1_i)
									.replace(/</g, "<")
									.replace(">", ">") +
								"</span>";
							break;
						}
						//值1删除的
					} else if (ps.v1_eq_max > ps.v2_eq_max) {
						//ps.v1_new_value += "<span style='" + op.value1_style + "'>值1删除的" + op.value1.substr(ps.v1_i, ps.v1_start - ps.v1_i).replace(/</g,"<").replace(">",">") + "</span>";
						ps.v2_new_value +=
							"<span style='color:green'>" +
							op.value1
								.substr(ps.v1_i, ps.v1_start - ps.v1_i)
								.replace(/</g, "<")
								.replace(">", ">") +
							"</span>";
						ps.v1_i = ps.v1_start;
					} else {
						//值2增加的
						ps.v2_new_value +=
							"<del style='color:red'>" +
							op.value2
								.substr(ps.v2_i, ps.v2_start - ps.v2_i)
								.replace(/</g, "<")
								.replace(">", ">") +
							"</del>";
						ps.v2_i = ps.v2_start;
					}
				}
			}
			op.value1 = ps.v1_new_value;
			op.value2 = ps.v2_new_value;
			//有多个连着修改的放在一起
			var addRule = /<del style='color:red'>((?!<del).)+<\/del>/g;
			var deleteRule = /<span style='color:green'>((?!<span).)+<\/span>/g;
			var allRule = /(<span style='color:green'>((?!<span).)+<\/span><del style='color:red'>((?!<del).)+<\/del>){2,}/g;
			op.value2 = op.value2.replace(allRule, function (str) {
				var beforText = "",
					afterText = "";
				var beforeMatch = str.match(deleteRule);
				for (var i = 0; i < beforeMatch.length; i++) {
					var m = beforeMatch[i].match(deleteRule);
					beforText += RegExp.$1;
				}
				var afterMatch = str.match(addRule);
				for (var i = 0; i < afterMatch.length; i++) {
					var m = afterMatch[i].match(addRule);
					afterText += RegExp.$1;
				}
				return (
					"<span style='color:green'>" +
					beforText +
					"</span><del style='color:red'>" +
					afterText +
					"</del>"
				);
			});
			return op;
		}

		let fixedBtn = $(".fixed_btn");
		window.onscroll = () => {
			if (timer !== null) {
				clearTimeout(timer);
			}
			timer = setTimeout(() => {
				if (document.documentElement.scrollTop >= 400) {
					fixedBtn.css("display", 'block');
				} else {
					fixedBtn.css("display", 'none');
				}
				timer = null;
			}, 500);
		};
	</script>
	<!-- <script type="text/javascript" src="https://v1.cnzz.com/z_stat.php?id=1280944116&web_id=1280944116"></script> -->
</body>

</html>